home *** CD-ROM | disk | FTP | other *** search
- # CVS $Id: timeout.tcl,v 1.3 1995/02/03 16:55:27 zibi Exp $
- global t
- set t 0
-
- source tools.tcl
-
- proc Exit {cbs} {
- VtClose
- }
-
- proc timeout {label cbs} {
- global t
-
- set id [VtAddTimeOut -callback "timeout $label" -interval 500]
- VtSetValues $label -label "Time out called $t times\nTimer ID is $cbs" \
- -userData $id
- incr t
- }
-
- proc Start {cbs} {
- set id [GetDialogKeyCBS $cbs id]
- set label [GetDialogKeyCBS $cbs label]
-
- if {$id != ""} {return}
-
- set id [VtAddTimeOut -callback "timeout $label" -interval 500]
-
- SetDialogKeyCBS $cbs id $id
-
- set but [GetDialogKeyCBS $cbs Stop]
- VtSetSensitive $but 1
-
- set but [GetDialogKeyCBS $cbs Start]
- VtSetSensitive $but 0
- }
-
- proc Stop {cbs} {
- set id [GetDialogKeyCBS $cbs id]
-
- VtRemoveTimeOut $id
-
- SetDialogKeyCBS $cbs id ""
-
- set but [GetDialogKeyCBS $cbs Stop]
- VtSetSensitive $but 0
-
- set but [GetDialogKeyCBS $cbs Start]
- VtSetSensitive $but 1
- }
-
-
- set ap [VtOpen TimeOut]
-
- set dlog [VtFormDialog $ap.dlg ]
-
- set lab [VtLabel $dlog.lab -label "Waiting for start...."]
-
- set sep [VtSeparator $dlog.sep -leftSide FORM -rightSide FORM]
-
- set rc [VtRowColumn $dlog.rc -rightSide FORM -leftSide FORM -horizontal]
-
- foreach b {Start Stop Exit} {
- set but [VtPushButton $rc.$b -label $b -callback $b]
- SetDialogKey $dlog $b $but
- }
-
- SetDialogKey $dlog label $lab
- SetDialogKey $dlog id ""
-
- # Get the Stop button and desensitize it
- set but [GetDialogKey $dlog Stop]
- VtSetSensitive $but 0
-
- VtShow $dlog
-
-
- VtMainLoop
-